<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta name="apple-mobile-web-app-capable" content="no">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="format-detection" content="telephone=no,email=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <link href="{:getConfig()['favicon']}" rel="icon">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1.2, user-scalable=0" name="viewport" />
    <title>在线支付 - 网上支付 安全快速！</title>
        <!-- 依 赖 样 式-->
        <link rel="stylesheet" href="/static/component/pear/css/pear.css" type="text/css"/>
     <link href="/static/index/pay/console/qrcode.css" rel="stylesheet" />
     <script src="/static/index/js/jquery-3.2.1.min.js"></script>
         <link rel="stylesheet" href="/static/index/user/assets/vendor/css/rtl/core.css" class="template-customizer-core-css" />
    <link rel="stylesheet" href="/static/index/user/assets/vendor/css/rtl/theme-default.css" class="template-customizer-theme-css" />
    <link rel="stylesheet" href="/static/index/user/assets/css/demo.css" />
 <link rel="stylesheet" href="/static/index/user/assets/vendor/libs/sweetalert2/sweetalert2.css" />
    <style>
        body {
            background: #f2f2f4;
        }

        body, html {
            width: 100%;
            height: 100%;
        }

        *, :after, :before {
            box-sizing: border-box;
        }
        

        * {
            margin: 0;
            padding: 0;
        }

        img {
            max-width: 100%;
        }

        #header {
            height: 60px;
            border-bottom: 2px solid #eee;
            background-color: #fff;
            text-align: center;
            line-height: 60px;
        }

            #header h1 {
                font-size: 20px;
            }

        #main {
            overflow: hidden;
            margin: 0 auto;
            padding: 20px;
            padding-top: 80px;
            width: 992px;
            max-width: 100%;
        }

            #main .left {
                float: left;
                width: 40%;
                box-shadow: 0 0 60px #b5f1ff;
            }

        .left p {
            margin: 10px auto;
        }

        .make {
            padding-top: 15px;
            border-radius: 10px;
            background-color: #fff;
            box-shadow: 0 3px 3px 0 rgba(0,0,0,.05);
            color: #666;
            text-align: center;
            transition: all .2s linear;
        }

            .make .qrcode {
                margin: auto;
            }

            .make .money {
                margin-bottom: 0;
                color: #f44336;
                font-weight: 600;
                font-size: 18px;
            }

        .info {
            padding: 15px;
            width: 100%;
            border-radius: 0 0 10px 10px;
            background: #32343d;
            color: #f2f2f2;
            text-align: center;
            font-size: 14px;
        }

        #main .right {
            float: right;
            padding-top: 25px;
            width: 60%;
            color: #ccc;
            text-align: center;
        }

        @media (max-width:768px) {
            #main {
                padding-top: 30px;
            }

                #main .left {
                    width: 100%;
                }

                #main .right {
                    display: none;
                }
        }
    </style>
</head>
<body>
    <div id="main">
        <div class="left">
            <div class="make">
                {if condition="$order.type == 'qqpay'"}
                    <p><img src="/static/index/pay/console/images/qqpay.jpg" alt="" style="height:30px;"></p>
                {/if}
                {if condition="$order.type == 'alipay'"}
                    <p><img src="/static/index/pay/console/images/alipay.jpg" alt="" style="height:30px;"></p>
                {/if}
                {if condition="$order.type == 'wxpay'"}
                    <p><img src="/static/index/pay/console/images/weixin.jpg" alt="" style="height:30px;"></p>
                {/if}
                <p>商品名称：{$order.name}</p>
                <p class="money" id="price" style="font-weight:bold; color:green">
                    {$order.truemoney}
                    <button id='copy' class="layui-btn layui-btn-default copy" data-clipboard-text="{$order.truemoney}" >复制金额</button>
                    </p>
                <p>
                                <font face="微软雅黑" size="+1" color="#FF000">请务必按照上方金额付款</font><br>


                </p>

                <center><p class="qrcode" id="qrcode" ><img class="kalecloud" id="qrcode_load" src="/static/index/images/status/loading.gif" style="display: block;"></p></center>
                <p class="money" style="font-weight:bold; color:red;padding:10px">
                    请输入 {$order.truemoney} 不要多付或少付<br>
                    {:$console_notity}
                </p>
                <center>
                        <?php if ($order['type'] == 'alipay' && $basic['is_jump'] == 1): ?>
                            <a id="startApp" type="button" class="btn btn-lg btn-block" style="color:white;background-color:#1e9fff;font-size:13px;width:250px;display:none"><span>启动支付宝支付</span></a>
                        <?php endif; ?>
                        <?php if ($order['type'] == 'wxpay' && $basic['is_jump'] == 1): ?>
                             <a id="startApp" type="button" class="btn btn-lg btn-block" style="color:white;background-color:#16b777

;font-size:13px;width:250px;display:none"><span>启动微信支付</span></a>
                        <?php endif; ?>
                        <?php if ($order['type'] == 'qqpay' && $basic['is_jump'] == 1): ?>
                                <a id="startApp" type="button" class="btn btn-lg btn-block btn-danger" style="color:white;font-size:13px;width:250px;display:none"><span>启动QQ支付</span></a>
                        <?php endif; ?>
                    
                    
                    <p id="startApp_text" style="font-size:12px;color:red;display:none;font-weight:900">请先保存二维码</p>
                    {if condition="getConfig()['reportPos'] eq 1"}
                    <button onclick="showGlobalAd();" class="layui-btn layui-btn-red" style="margin-bottom:10px;">{:getConfig()['reportTitle']}</button>
                    {/if}
                </center>

                <div class="info">

                    <p id="divTime">正在获取二维码,请稍等...</p>
                    <p>商户订单号：{$order.out_trade_no}</p>
                    {if condition="$order.type == 'qqpay'"}
                        <p>请使用QQ扫一扫</p>
                    {/if}
                    {if condition="$order.type == 'alipay'"}
                        <p>请使用支付宝扫一扫</p>
                    {/if}
                    {if condition="$order.type == 'wxpay'"}
                        <p>请使用微信扫一扫</p>
                    {/if}
                </div>
            </div>
        </div>
        <div class="right">
            {if condition="$order.type == 'qqpay'"}
                <img src="/static/index/pay/console/images/qqpay-sys.png" id="rightImage" alt="">
            {/if}
            {if condition="$order.type == 'alipay'"}
                <img src="/static/index/pay/console/images/alipay-sys.png" />
            {/if}
            {if condition="$order.type == 'wxpay'"}
                <img src="/static/index/pay/console/images/wxpay-sys.png" alt="">
            {/if}

        </div>
    </div>
<!-- 弹窗开始 -->
{if condition="$is_payPopUp == 1"}
<div class="web_notice" style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0,0,0,0.3);z-index: 99999;">
		<div style="position: fixed;top: 50%;left: 50%;width: 350px;background: #FFF;transform: translate(-50%, -50%);border-radius: 40px;padding: 50px 40px;">
		                 {if condition="$order.type == 'qqpay'"}
                            <h3 style="font-weight: bold;text-align: center;font-size: 30px;">QQ支付注意</h3>
                            {/if}
                            {if condition="$order.type == 'alipay'"}
                              <h3 style="font-weight: bold;text-align: center;font-size: 30px;">支付宝支付注意</h3>
                            {/if}
                            {if condition="$order.type == 'wxpay'"}
                                <h3 style="font-weight: bold;text-align: center;font-size: 30px;">微信支付注意</h3>
                            {/if}  
	
		<div style="font-size: 16px;margin-top: 26px;line-height: 30px;color: #999;">
		<br>
		<font color="purple"><b>请在支付时务必支付订单金额，多付或少付系统都无法识别，这将导致你的订单无法完成。
		<br>
		<br>
		<font color="red">订单金额：{$order.truemoney}元【注意小数点】</font></b><font color="red">
		<br>
		</font>
		</font>
		</div>
		<font color="purple">
		<a style="display: block;background: #98a3ff;color: #FFF;text-align: center;font-weight: bold;font-size: 19px;line-height: 60px;margin: 0 auto;margin-top: 45px;border-radius: 32px;width: 80%;" onclick="javascript:document.querySelector('.web_notice').remove()">懂了</a>
		</font>
		</div>
		</div>
{/if}
    <script src="/static/component/layer/layer.js"></script>
    <script src="/static/index/user/assets/vendor/libs/sweetalert2/sweetalert2.js"></script>
    <script type="text/javascript" src="/static/index/user/assets/vendor/libs/clipboard/clipboard.js"></script>
  <script src='/static/index/pay/js/devtools-detector.js'></script>
    <script type="text/javascript">

     var intDiff = parseInt('{$ms}');//倒计时总秒数量
     function timer(intDiff){
         var timerId = window.setInterval(function(){
         var day=0,
             hour=0,
             minute=0,
             second=0;//时间默认值
         if(intDiff > 0){
         	day = Math.floor(intDiff / (60 * 60 * 24));
             hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
             minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
            second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
         }
		if (minute <= 9) minute = '0' + minute;
		if (second <= 9) second = '0' + second;
		if (hour <= 0 && minute <= 0 && second <= 0) {
			$("#divTime").html("<small style='color:red; font-size:26px'>订单二维码已过期</small>");
            $("#qrcode").html('<img id="qrcode_load" src="/static/index/images/status/qrcode_timeout.png">');//输出过期二维码提示图片
		}else{
			$("#divTime").html("二维码有效时间:<small style='color:red; font-size:26px'>" + minute + "</small>分<small style='color:red; font-size:26px'>" + second + "</small>秒,失效勿付");
		}
	    if(intDiff < 0){
		    clearInterval(timerId);
		}
		intDiff--
		
		}, 1000);
     }

     $(function(){
         timer(intDiff);
     });

	order();
	updateQrOk = 0;
	updateQrImg= 0;
	updateQrNo = 0;
	lastQrImg = '';
     //订单监控  {订单监控}
	function order(){
        var _v = new Date().getTime();
        $.get("/Pay/ConSole", { TradeNo: "{$order.out_trade_no}", v: _v }, function (result) {
			//成功
     		if(result.code == '200' && updateQrOk==0){
				updateQrOk==1;
				$("#divTime").html("<small style='color:red; font-size:22px'>"+ result.msg +"</small>");
                    $("#qrcode").html('<img id="qrcode_load" src="/static/index/images/status/pay_ok.png">');//支付成功
 				//回调页面
         		window.clearInterval(orderlst);
				layer.msg('支付成功，正在跳转中...');
				window.location.href=result.url;
     		}
     		//支付二维码
     		if(result.code == '100' && (updateQrImg == 0 || (result.qr_url && lastQrImg !== result.qr_url))){
 				updateQrImg = 1;
 				lastQrImg = result.qr_url;
                    $("#qrcode").html('<img id="qrcode_load"  src="' + result.qr_url + '">');

                    //二维码获取成功
                    if ("{$order.type}" == 'alipay')
				{
				    
				    if(isMobilCheck())
                    {
                        $("#startApp").attr("href", "{$order.h5_qrurl|raw}");
    				    $("#startApp").show();
    				    $("#startApp_text").show();
    				}
                    }
                    if ("{$order.type}"== 'wxpay')
				    {
				        if(isMobilCheck())
                        {
                            if("{$code}" == "qqpay_wzq"){
                                $("#startApp").attr("href", "{$order.h5_qrurl|raw}");
                                $("#startApp").html('点击跳转付款');
                                $("#qrcode").html("<p style='color:red;font-weight:bold;font-size:20px;'>请在浏览器内点击按钮付款</p><p style='color:red;font-size:20px;font-weight:bold;'>一定要在手机浏览器内,禁止微信/QQ内点击</p>");
                                $("#startApp_text").html('请打开浏览器付款');
                            }else{
                                $("#startApp").attr("href", "{$order.h5_qrurl|raw}");
                            }
		    			    $("#startApp").show();
                            $("#startApp_text").show();
                        }
                      
				    }
                if ("{$order.type}"== 'qqpay')
				    {
				        if(isMobilCheck())
                        {
    				        if('{$code}' == 'qqpay_zg'  && '{$basic.is_jump}' == '1'){
                                $("#startApp").attr("href",result.h5_qrurl);
		    			        $("#startApp").show();
                                $("#startApp_text").show();
                                var url_scheme = result.h5_qrurl;
                                layer.msg('正在自动唤醒QQ...', {shade: 0,time: 1000});
		                        window.location.href = url_scheme;
                            }else{
                                $("#startApp").attr("href", "{$order.h5_qrurl|raw}");
		    			        $("#startApp").show();
		    			        $("#startApp_text").show();
                            }
                        }
                      
				    }
			}
         	//订单已经超时
     		if(result.code == '201' && updateQrNo==0){
				updateQrNo==1;
				$("#divTime").html("<small style='color:red; font-size:22px'>"+ result.msg +"</small>");
     			window.clearInterval(orderlst);
     			Swal.fire({
                    title: '支付失败',
                    text: result.msg,
                    icon: 'error',
                    customClass: {
                      confirmButton: 'btn btn-primary'
                    },
                    buttonsStyling: false
                }).then(function (result) {
                    var href = "{$timeout_url}";//获取跳转链接
                     if (href && href.indexOf('http') !== 0 && href != '/') {
                         href = "//" + href;
                     }
                    // 执行跳转
                    window.location.href = href;
                });
     		
         	}

     	},"JSON");
	}

	/**
     * 检验是否手机版，手机版直接跳转到APP支付
     * @@returns
     */
    function isMobilCheck() {
    	var userAgentInfo = navigator.userAgent;

            var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
            
            var mobile_flag = false;
            
            	//根据userAgent判断是否是手机
             for (var v = 0; v < mobileAgents.length; v++) {
                if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
                      mobile_flag = true;
                      break;
                }
             }
             var screen_width = window.screen.width;
             var screen_height = window.screen.height;
            
            //根据屏幕分辨率判断是否是手机
            if (screen_width > 325 && screen_height < 750) {
                mobile_flag = true;
            }
            
            return mobile_flag;
    }


	//周期监听
	orderlst = window.setInterval(function () {
		order();
	}, 2000);
        
    
    //Copy Api Info
            $("#copy").click(function () {
                clipboard = new ClipboardJS('.copy');
                clipboard.on('success', function(e) {
                    Swal.fire({
                        icon: 'success',
                        title: '复制成功',
                        customClass: {
                          confirmButton: 'btn btn-success'
                        }
                    });
                });
                
                clipboard.on('error', function(e) {
                    Swal.fire({
                        icon: 'error',
                        title: '复制失败,请手动复制',
                        customClass: {
                          confirmButton: 'btn btn-danger'
                        }
                    });
                });
            });
            
    function showGlobalAd(){
        Swal.fire({
        html:'{:getConfig()['reportTips']}',
        showCancelButton: true,
        confirmButtonText: '{:getConfig()['reportYes']}',
        cancelButtonText: '{:getConfig()['reportNo']}',
        customClass: {
          confirmButton: 'btn btn-primary me-3',
          cancelButton: 'btn btn-label-secondary'
        },
        buttonsStyling: false
      }).then(function (result) {
        if (result.value) {
          location.replace('{:getConfig()['reportUrl']}');
        }
      });
    }
    </script>


    {if condition="$yuyin_tips == '1'"}
        <script>
            speckText(0)
            function speckText(str) {
                var url = "/static/index/pay/console/yuyin.mp3";
                var voiceContent = new Audio(url);
                voiceContent.src = url;
                voiceContent.play();
            }
        </script>
    {/if}

    <script>
function jscode(){
    var pay_type = '{$order.type}';//支付方式
    var pay_code ='{$code}'; //获取通道类型
    if(pay_type=='alipay' && '{$basic.is_jump}' == '1'){
        var url_scheme = '{$order.h5_qrurl|raw}';
        layer.msg('正在自动唤醒支付宝...', {shade: 0,time: 1000});
		window.location.href = url_scheme; 
    }else if(pay_type=='qqpay' && pay_code != 'qqpay_zg' && pay_code != 'qqpay_wzq' && '{$basic.is_jump}' == '1'){
        var url_scheme = '{$order.h5_qrurl|raw}';
        layer.msg('正在自动唤醒QQ...', {shade: 0,time: 1000});
		window.location.href = url_scheme;
    }
}

if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
    setTimeout(jscode(), 3000 )
}

   function is_weixin() {
      var ua = navigator.userAgent.toLowerCase();
      if (ua.match(/MicroMessenger/i) == "micromessenger" || ua.match(/QQ/i) == "qq") {
        return true;
      } else {
        return false;
      }
    }
    var isWeixin = is_weixin();
    var pay_code ='{$code}'; //获取通道类型
    var isQQBrowser = navigator.userAgent.indexOf("QQBrowser") > -1;
    if(isWeixin && pay_code == 'qqpay_wzq' && !isQQBrowser){
      $("html").html(`    <style>
        body,html{width:100%;height:100%}
        *{margin:0;padding:0}
        body{background-color:#fff}
        #browser img{
            width:50px;
        }
        #browser{
            margin: 0px 10px;
            text-align:center;
        }
        #contens{
            font-weight: bold;
            color: #2466f4;
            margin:-285px 0px 10px;
            text-align:center;
            font-size:20px;
            margin-bottom: 125px;
        }
        .top-bar-guidance{font-size:15px;color:#fff;height:70%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(/static/index/pay/jump/banner.png) center top/contain no-repeat}
        .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
        .app-download-tip{margin:0 auto;width:290px;text-align:center;font-size:15px;color:#2466f4;background:url() left center/auto 15px repeat-x}
        .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
        .app-download-tip .icon-sgd{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
        .app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}
    </style><div class="top-bar-guidance">
    <p>点击右上角<img src="/static/index/pay/jump/3dian.png" class="icon-safari">在 浏览器 打开</p>
    <p>苹果设备<img src="/static/index/pay/jump/iphone.png" class="icon-safari">安卓设备<img src="/static/index/pay/jump/android.png" class="icon-safari">↗↗↗</p>
</div>

<div id="contens">
<p><br/><br/></p>
<p>1.本站不支持 微信或QQ 内访问</p>
<p><br/></p>
<p>2.请按提示在手机 浏览器 打开</p>
</div>

<p><br/></p>
<div class="app-download-tip">
    <span class="guidance-desc">点击右上角<img src="/static/index/pay/jump/3dian.png" class="icon-sgd">进入浏览器打开</span>
</div>
`);
    }

</script>
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>
</body>
</html>
